package giaodien;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import ketnoi.KetNoi;

public class SuaHangHoa extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	KetNoi ketnoi;
	public JTextField txtmah=new JTextField();
	public JTextField txttenh=new JTextField();
	public JTextField txtman=new JTextField();
	public JTextField txtdv=new JTextField();
	public JTextField txtdb=new JTextField();
	public JButton dongy;
	public JButton huy;
	public SuaHangHoa() {
		ketnoi=new KetNoi();
		setTitle("Thêm 1 hàng hóa");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setLocation((Toolkit.getDefaultToolkit().getScreenSize().width-getWidth())/4, (Toolkit.getDefaultToolkit().getScreenSize().height-getHeight())/4);
		setSize(700, 120);
		setResizable(false);
		setAlwaysOnTop(true);
		giaodien();
		}
	void giaodien(){
		txtdb.setHorizontalAlignment(JTextField.RIGHT);
		txtdv.setHorizontalAlignment(JTextField.RIGHT);
		txtmah.setHorizontalAlignment(JTextField.RIGHT);
		txtman.setHorizontalAlignment(JTextField.RIGHT);
		txttenh.setHorizontalAlignment(JTextField.RIGHT);
		JPanel pnchung=new JPanel();
		pnchung.setLayout(new BoxLayout(pnchung, BoxLayout.Y_AXIS));
		
		JPanel pntop=new JPanel();
		pntop.setLayout(new FlowLayout(FlowLayout.LEFT,18,0));
		pntop.setPreferredSize(new Dimension(600,570));
		pnchung.add(pntop);
		
		JPanel pn1=new JPanel();
		pn1.setLayout(new FlowLayout(FlowLayout.LEFT));
		pntop.add(pn1);
		JPanel pn1_1_1=new JPanel();
		pn1_1_1.setPreferredSize(new Dimension(125, 45));
		pn1_1_1.setLayout(new BoxLayout(pn1_1_1, BoxLayout.Y_AXIS));
		pn1.add(pn1_1_1);
		JLabel lb1=new JLabel("Mã hàng");
		lb1.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 20));
		pn1_1_1.add(lb1);
		pn1_1_1.add(txtmah);
		
		JPanel pn1_1_2=new JPanel();
		pn1_1_2.setPreferredSize(new Dimension(125, 45));
		pn1_1_2.setLayout(new BoxLayout(pn1_1_2, BoxLayout.Y_AXIS));
		pn1.add(pn1_1_2);
		JLabel lb2=new JLabel("Tên hàng");
		lb2.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 20));
		pn1_1_2.add(lb2);
		pn1_1_2.add(txttenh);
		
		JPanel pn1_1_3=new JPanel();
		pn1_1_3.setPreferredSize(new Dimension(125, 45));
		pn1_1_3.setLayout(new BoxLayout(pn1_1_3, BoxLayout.Y_AXIS));
		pn1.add(pn1_1_3);
		JLabel lb3=new JLabel("Mã nhóm");
		lb3.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 20));
		pn1_1_3.add(lb3);
		pn1_1_3.add(txtman);
		
		JPanel pn1_1_4=new JPanel();
		pn1_1_4.setPreferredSize(new Dimension(125, 45));
		pn1_1_4.setLayout(new BoxLayout(pn1_1_4, BoxLayout.Y_AXIS));
		pn1.add(pn1_1_4);
		JLabel lb4=new JLabel("Đơn vị");
		lb4.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 20));
		pn1_1_4.add(lb4);
		pn1_1_4.add(txtdv);
		
		JPanel pn1_1_5=new JPanel();
		pn1_1_5.setPreferredSize(new Dimension(125, 45));
		pn1_1_5.setLayout(new BoxLayout(pn1_1_5, BoxLayout.Y_AXIS));
		pn1.add(pn1_1_5);
		JLabel lb5=new JLabel("Diễn  giải");
		lb5.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 20));
		pn1_1_5.add(lb5);
		pn1_1_5.add(txtdb);

		JPanel pnbottom=new JPanel();
		pnbottom.setPreferredSize(new Dimension(500,40));
		pnbottom.setLayout(new FlowLayout(FlowLayout.RIGHT,12,5));
		dongy=new JButton("Đồng ý");
		dongy.add(Box.createRigidArea(new Dimension(40,15)));
		huy=new JButton("Hủy");
		huy.add(Box.createRigidArea(new Dimension(40, 15)));
		JLabel lbtrung=new JLabel();
		lbtrung.setPreferredSize(new Dimension(0, 10));
		pnbottom.add(dongy);
		pnbottom.add(huy);
		pnbottom.add(lbtrung);
		pnchung.add(pnbottom);
		add(pnchung);
	}
}
